//
//  AddressBookTableViewCell.m
//  ZKingAddressBook
//
//  Created by zkingsoft on 15/12/24.
//  Copyright (c) 2015年 zkingsoft. All rights reserved.
//

#import "AddressBookTableViewCell.h"

@implementation AddressBookTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // 头像
        self.peopleImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.peopleImageView];
        self.peopleImageView.layer.cornerRadius = 26;
        self.peopleImageView.layer.masksToBounds = YES;
        [self.peopleImageView makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.left).offset(13);
            make.width.and.height.equalTo(53);
            make.top.equalTo(self.contentView.top).offset(7);
        }];
        
        // 名字
        self.peopleNameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.peopleNameLabel];
        [self.peopleNameLabel makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.contentView.centerY);
            make.left.equalTo(self.peopleImageView.right).offset(10);
            make.width.equalTo(180);
            make.height.equalTo(30);
        }];
        
        // send call
        self.peopleSendMessageImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.peopleSendMessageImageView];
        self.peopleSendMessageImageView.userInteractionEnabled = YES;
        self.peopleSendMessageImageView.image = [UIImage imageNamed:@"ic_home_w.png"];
        [self.peopleSendMessageImageView makeConstraints:^(MASConstraintMaker *make) {
            make.width.and.height.equalTo(20);
            make.centerY.equalTo(self.contentView.centerY);
        }];
        
        self.peopleCallImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.peopleCallImageView];
        self.peopleCallImageView.userInteractionEnabled = YES;
        self.peopleCallImageView.image = [UIImage imageNamed:@"ic_me_w.png"];
        [self.peopleCallImageView makeConstraints:^(MASConstraintMaker *make) {
            make.width.and.height.equalTo(20);
            make.centerY.equalTo(self.contentView.centerY);
            make.right.equalTo(self.contentView.right).offset(-20);
            make.left.equalTo(self.peopleSendMessageImageView.right).offset(20);
        }];
    }
    
    return self;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
